<?php
/**
 * @Author:      zk
 * @DateTime:    18-7-30 下午5:56
 * @Description: 申请编号表相关
 */

class OAApplyNumber extends Eloquent
{
    protected $table = 'oa_apply_number';

    /**
     * @Author:      zk
     * @DateTime:    18-7-30 下午6:17
     * @Description: 根据审批模板id获取当前日期的申请编号及当前增长值
     * @param int $approval_model_id 审批模板id
     * @return array
     */
    public static function getNowApplyNumberByApprovalModelId($approval_model_id){
        $select_arr = [
            'apply_number', 'approval_model_id', 'now_add_value', 'date', 
        ];
        $info = OAApplyNumber::where('approval_model_id', $approval_model_id)
                ->where('date', date('Y-m-d', time()))
                ->orderBy('id', 'desc')
                ->first();
        return $info;
    }
    
}
